home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / RTVBE210.ZIP / DEBUG.H < prev    next >
C/C++ Source or Header  |  1996-04-23  |  6KB  |  229 lines

  1. /****************************************************************************
  2. *
  3. *                   Copyright (C) 1996 SciTech Software
  4. *                           All rights reserved.
  5. *
  6. * Filename:     $Workfile:   debug.h  $
  7. * Version:      $Revision:   1.5  $
  8. *
  9. * Language:     ANSI C
  10. * Environment:  any
  11. *
  12. * Description:  General header file for operating system portable code.
  13. *
  14. * $Date:   23 Apr 1996 06:16:12  $ $Author:   KendallB  $
  15. *
  16. ****************************************************************************/
  17.  
  18. #ifndef __DEBUG_H
  19. #define __DEBUG_H
  20.  
  21. /* We have the following defines to identify the compilation environment:
  22.  *
  23.  *    __16BIT__        Compiling for 16 bit code (any environment)
  24.  *    __MSDOS__        Compiling for MS-DOS (includes __WINDOWS16__)
  25.  *  __REALDOS__     Compiling for MS-DOS (excludes __WINDOWS16__)
  26.  *  __MSDOS16__     Compiling for 16 bit MS-DOS
  27.  *  __MSDOS32__     Compiling for 32 bit MS-DOS
  28.  *  __WINDOWS__     Compiling for Windows
  29.  *    __WINDOWS16__    Compiling for 16 bit Windows (__MSDOS__ also defined)
  30.  *    __WINDOWS32__    Compiling for 32 bit Windows
  31.  *  __OS2__         Compiling for OS/2
  32.  *  __OS2_16__      Compiling for 16 bit OS/2
  33.  *  __OS2_32__         Compiling for 32 bit OS/2
  34.  *  __UNIX__           Compiling for Unix
  35.  *
  36.  */
  37.  
  38. #ifdef    __SC__
  39. #if        __INTSIZE == 4
  40. #define __SC386__
  41. #endif
  42. #endif
  43.  
  44. #ifdef    __GNUC__
  45. #define    __cdecl        /* GCC doesn't know about __cdecl modifiers            */
  46. #define    __FLAT__    /* GCC is always 32 bit flat model                    */
  47. #endif
  48.  
  49. /* For the Metaware High C/C++ compiler, there is no _cdecl calling
  50.  * convention. The conventions can be changed, but it is a complicated
  51.  * process involving #pragmas, and all externally referenced functions
  52.  * will use stack based calling conventions. We also need to change the
  53.  * global aliasing conventions to use underscores for external function
  54.  * and variables names, so that our assembler routines will link
  55.  * correctly (except of course the main function - man what a PAIN!).
  56.  */
  57.  
  58. #ifdef    __HIGHC__
  59. #define    __cdecl
  60. #define    __FLAT__    /* High C is always 32 bit flat model                */
  61. #pragma Global_aliasing_convention("_%r")
  62. extern main();
  63. #pragma Alias(main,"main")
  64. #endif
  65.  
  66. #if     defined(__MSDOS__) || defined(__DOS__) || (defined(M_I86) && !defined(__SC386__))
  67. #ifndef __MSDOS__
  68. #define __MSDOS__
  69. #endif
  70. #if     defined(__386__) || defined(__FLAT__) || defined(__NT__) || defined(__SC386__)
  71. #ifndef  __MSDOS32__
  72. #define __MSDOS32__
  73. #endif
  74. #ifndef __REALDOS__
  75. #define __REALDOS__
  76. #endif
  77. #elif   (defined(_Windows) || defined(_WINDOWS)) && !defined(__DPMI16__)
  78. #ifndef    __16BIT__
  79. #define    __16BIT__
  80. #endif
  81. #ifndef __WINDOWS16__
  82. #define    __WINDOWS16__
  83. #endif
  84. #ifndef __WINDOWS__
  85. #define __WINDOWS__
  86. #endif
  87. #else
  88. #ifndef    __16BIT__
  89. #define    __16BIT__
  90. #endif
  91. #ifndef __MSDOS16__
  92. #define __MSDOS16__
  93. #endif
  94. #ifndef __REALDOS__
  95. #define __REALDOS__
  96. #endif
  97. #endif
  98. #elif   defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
  99. #ifndef    __WINDOWS32__
  100. #define    __WINDOWS32__
  101. #endif
  102. #ifndef __WINDOWS__
  103. #define __WINDOWS__
  104. #endif
  105. #elif   defined(__OS2__)
  106. #ifndef __OS2__                 /* TODO: to be completed */
  107. #define __OS2__
  108. #define    __OS2_32__                /* Default to 32 bit OS/2 */
  109. #endif
  110. #else
  111. #define __UNIX__                /* TODO: to be completed */
  112. #endif
  113.  
  114. /* We have the following defines to define the calling conventions for
  115.  * publicly accesible functions:
  116.  *
  117.  *  _PUBAPI - Compiler default calling conventions for all public 'C' functions
  118.  *  _ASMAPI - Calling conventions for all public assembler functions
  119.  *  _DLLAPI - Calling conventions for all DLL exported functions
  120.  *  _DLLVAR - Modifier to export/import globals in 32 bit DLL's
  121.  *  _EXPORT - Expands to _export when compiling a DLL
  122.  */
  123.  
  124. #define _PUBAPI    
  125. #define _ASMAPI __cdecl
  126.  
  127. #if defined(_MSC_VER) && defined(_WIN32) && !defined(__SC__)
  128. #define __PASCAL    __stdcall
  129. #else
  130. #define __PASCAL    __pascal
  131. #endif
  132.  
  133. #if     defined(__WINDOWS__)
  134. #ifdef  BUILD_DLL
  135. #define _DLLASM __export __cdecl
  136. #define _EXPORT __export
  137. #ifdef  __WINDOWS32__
  138. #define _DLLAPI __export __PASCAL
  139. #define _DLLVAR __export
  140. #else
  141. #define _DLLAPI  __export __far __pascal
  142. #define _DLLVAR
  143. #endif
  144. #else
  145. #define _DLLASM __cdecl
  146. #define    _EXPORT
  147. #ifdef  __WINDOWS32__
  148. #define _DLLAPI __PASCAL
  149. #define _DLLVAR __import
  150. #else
  151. #define _DLLAPI __far __pascal
  152. #define _DLLVAR
  153. #endif
  154. #endif
  155. #else
  156. #define _EXPORT
  157. #define _DLLAPI
  158. #define _DLLVAR
  159. #endif
  160.  
  161. /* Useful macros */
  162.  
  163. #define PRIVATE static
  164. #define PUBLIC
  165.  
  166. #ifdef  DEBUG
  167. #       define DBG(x) x
  168. #else
  169. #       define DBG(x)
  170. #endif
  171.  
  172. #ifndef NULL
  173. #       define NULL 0L
  174. #endif
  175.  
  176. #ifndef MAX
  177. #       define MAX(a,b) ( ((a) > (b)) ? (a) : (b))
  178. #endif
  179. #ifndef MIN
  180. #       define MIN(a,b) ( ((a) < (b)) ? (a) : (b))
  181. #endif
  182. #ifndef ABS
  183. #       define ABS(a)   ((a) >= 0 ? (a) : -(a))
  184. #endif
  185. #ifndef    SIGN
  186. #        define SIGN(a)    ((a) > 0 ? 1 : -1)
  187. #endif
  188.  
  189. /* General typedefs */
  190.  
  191. #ifndef __GENDEFS
  192. #define __GENDEFS
  193. typedef unsigned char   uchar;
  194. typedef unsigned short  ushort;
  195. typedef unsigned int    uint;
  196. typedef unsigned long   ulong;
  197. #ifndef    CLASSLIB_DEFS_H
  198. typedef int             bool;
  199. #endif
  200. #endif  /* __GENDEFS */
  201.  
  202. /* Includes Windows headers, as they define TRUE and FALSE */
  203.  
  204. #ifdef    __WINDOWS__
  205. #ifndef _WINDOWS_                   /* Dont include if already included */
  206. #define STRICT
  207. #define    WIN32_LEAN_AND_MEAN
  208. #include <windows.h>
  209. #endif
  210. #endif
  211.  
  212. /* Boolean truth values */
  213.  
  214. #undef    false
  215. #undef    true
  216. #undef    NO
  217. #undef    YES
  218. #define false       ((bool)0)
  219. #define true        ((bool)1)
  220. #define NO          ((bool)0)
  221. #define YES         ((bool)1)
  222. #undef    FALSE
  223. #undef    TRUE
  224. #define FALSE       ((bool)0)
  225. #define TRUE        ((bool)1)
  226.  
  227. #endif  /* __DEBUG_H */
  228.  
  229.